using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace Test {
	class Rss {



		static void MainXs() {


			Cache cac=new Cache("map");
			string src=cac.Get("http://maps.google.com/maps?q=manchester",100);
			string cords=Regex.Match(src,"center:{.+?}").Value;
			Console.WriteLine(cords);
		}






		static Cache c=new Cache("ld");
		static void MainX() {
			DAL dal=new DAL();
			string rss=c.Get(c["smf"],10);
			string[] items=Nod.Dbls(rss,"<item>");
			foreach(string itm in items)
			{
				string title=Nod.Rx(Nod.Dbl(itm,"<title>"),"<!\\[CDATA\\[(.+?)\\]\\]>");
				string cp=Nod.Rx(Nod.Dbl(itm,"<rx:CurrentPrice"),">(.+?)<");
				string bn=Nod.Dbl(itm,"<rx:BuyItNowPrice");
				string pd=Nod.Dbl(itm,"<pubDate>");
				string et=Nod.Rx(Nod.Dbl(itm,"<rx:EndTime"),">(\\d+?)<");
				DateTime fdat=new DateTime(1970,1,1).AddMilliseconds(double.Parse(et)).ToLocalTime();
				string ln=Nod.Rx(itm,"href=\"(.+?)\\?.+?\"");
				string id=Nod.Rx(itm,"href=\".+?(\\d+?)\\?.+?\"");
				//Console.WriteLine(ti+"-["+fdat.ToString("yyyy-MM-dd HH:mm:ss")+"]:"+float.Parse(cp)/100);
				//Console.WriteLine(title+"-["+fdat.ToString("yyyy-MM-dd HH:mm:ss")+"]:"+float.Parse(cp)/100);
				if((int)dal.NonQry("update bb set lastUpdate=getdate() where ekey='{0}'",id)==0)
					dal.NonQry("insert into bb(ekey,title,endTime,pri,type)values({0},'{1}','{2:yyyy-MM-dd HH:mm:ss}',{3},'{4}')",id,title.Replace("'","''"),fdat,cp,bn==null?'B':'A');
			}
		}
		/*
	create table bb(id int identity,ekey bigint primary key,inserted datetime default getdate(),lastUpdate datetime default getdate(),endTime datetime,title varchar(200))
		*/
		static void MainC() {
			string str=c.Get(c["l"],5);
			string frm=Nod.Dbl(str,"<form");
			string[] inp=Nod.Rxs(frm,"<input.+?/>");
		}
		static void MainXx() {

			PostLoader ld=new PostLoader();
			string src=ld.Get("https://online.lloydsbank.co.uk/personal/primarylogin");
			Inputs inp=new Inputs(src);
			PostQueryStr qs=new PostQueryStr(inp);
			qs.Add("frmLogin:strCustomerLogin_userID",c["uid"]);
			qs.Add("frmLogin:strCustomerLogin_pwd",c["pwd"]);
			qs.Add("frmLogin:loginRemember","on");
			qs.Add("frmLogin");
			qs.Add("submitToken");
			qs.Add("target");
			qs.Add("hdn_mobile");
			qs.Add("hasJS","true");
			qs.Add("frmLogin:btnLogin1","null");

			string src2=ld.Post("https://online.lloydsbank.co.uk"+inp.frmAction,qs.ToString());
			string src2c=ld.Get("https://secure.lloydsbank.co.uk/personal/login?mobile=false");
			string src3=ld.Get("https://online.lloydsbank.co.uk/personal/a/logon/entermemorableinformation.jsp");

			Inputs inp2=new Inputs(src3);




		}
	}
}
